
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="zh-cn" xmlns="http://www.w33.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
	<title>旧衣物回收</title>
	<link href="css/lib.css" rel="stylesheet" type="text/css"/>
	<style type="text/css">
		#content{
			cursor: pointer;
			margin: 15px auto;
			width: 70%;
			height: 60px;
			background-color: #cae6c5;
		}
		#content p{text-align: center;
			font-size: 30px;
			line-height: 60px;
			font-weight: bold;
		}
		.form{
			margin-top:10px;
			padding-top: 30px;
			width: 100%;
			height: 620px;
			border-radius: 30px;
background-color: #cae6c5;
		}
		.form form{
			width: 80%;
			margin-left: 260px;
			font-size: 22px;
			font-weight: bold;
		}
		.form input{
			margin: 6px 0px;
			font-size: 24px;
			width: 50%;
			height: 36px;
			border: none;
			background-color:rgba(255,255,255,0.5);
		}
		.form button{cursor: pointer;
			margin-left: 220px;
			font-size: 24px;
			/*font-weight: bold;*/
			margin-top: 10px;
			width: 120px;
			height: 46px;
			border-radius: 15px;
			/*background-color: lightblue;*/
		}
	</style>
</head>

<body>
	<!-- 导航部分 -->
	<?php require 'top.php';?>
<!-- 上外边距，可以删除 -->
	<div style="height: 1px"></div>
<!-- 中间列表部分 -->
<?php

$con = "SELECT * FROM users WHERE uemail='".$_SESSION['login']."'";
$que = mysqli_query($config,$con);


$userinfo = mysqli_fetch_array($que,MYSQLI_ASSOC);
       if(isset($_SESSION['login'])){ ?>    <!-- 提前结束php语句 -->


<div id="content">
	<p>回收信息填写</p>
	<div class="form">
		<form method="post" name="form_reg" action="form_tj.php" enctype="multipart/form-data">
		<!-- action="checkreg.php" -->
		<label for="username">用户昵称:</label>
		<input id="username" type="text" required="required" value="<?php echo $userinfo['uname'] ?>" name="username" >
		<br/>

	

		<label>用户姓名:</label>
		<input id="name" type="text" required="required" placeholder="输入姓名" name="name"><br/>
		<label for="tel">用户电话:</label>
		<input id="tel" type="text" required="required" placeholder="输入十一位电话号码" name="tel"><br/>
		<label for="email">用户邮箱:</label>
		<input id="uemail" type="email" required="required" value="<?php echo $userinfo['uemail'] ?>" name="uemail">

		<br/>
		<label for="uaddress">收取地址:</label>
		<input id="uaddress" type="text" required="required" placeholder="输入取件地址" name="uaddress"><br/>
		<label for="">回收物品:</label>
		<!-- <input id="hsgood" type="text" required="required"  name="hsgood"> -->
		<select name="hsfl" style="height: 30px;font-weight: bold;font-size: 20px;">
			<option value="1">旧衣物</option>
			<option value="2">鞋类</option>
			<option value="3">运动道具、装备</option>
			<option value="4">其他</option>
		</select>
		<br/>
		<label class="th">上传图片：<input type="file" name="file" id="file" onchange="imgChange(this);" style="font-size: 20px;background-color:rgba(0,0,0,0);" />
        </label><br/>
        <div class="img" style="width: 150px;height: 150px;margin-left:110px;"><img id="imghead" src="images/4.jpg" style="width: 100%;height: 100%;" /> 
        <!--图片显示位置-->
        </div>

		<button type="submit" onclick="return check(); ">提交</button><br/>	

			<?php }else{?>
	<?php echo('<script type="text/javascript">
		alert("请登录！")</script>');
	header('Refresh:1;url=login/index.php'); } ?>
	</form>
	</div>

</div>
<script type="text/javascript">
    // 选择图片显示
    function imgChange(obj) {
//获取点击的文本框
        var file = document.getElementById("file");
        // console.log(file);
        var imgUrl = window.URL.createObjectURL(file.files[0]);
        var img = document.getElementById('imghead');
        img.setAttribute('src', imgUrl); // 修改img标签src属性值
    };


    
</script>

<script type="text/javascript">
	function check(){
		
		// 检查手机
		if(document.form_reg.tel.value=="")
		 {
		 	alert("请输入手机号");
		 	document.form_reg.tel.focus();
		 	return false;
		 }
		 var tel = document.form_reg.tel.value;
		 var c=/^1[34578]\d{9}$/;
		 if (!(c.test(tel))) {
		 	alert("手机号码格式错误！");
		 	document.getElementById("tel").value="";
		 	document.form_reg.tel.focus();
		 	return false;
		 }

	}
</script>
</body>
</html>